package trab4.rpc;

import java.util.* ;
import sim.core.* ;

public class Naming {

	@SuppressWarnings("unchecked")
	public static <T> T lookupServer( AbstractNode client, String url ) {
		ServerStub ss = registry.get( url ) ;
		return (T) ss.clientStub( client.endpoint ) ;
	}
	
	public static void rebindServer( String url, ServerStub stub ) {
		registry.put( url, stub ) ;
	}
	
	static Map<String, ServerStub> registry = new HashMap<String, ServerStub>() ;
}

